//
//  TextViewController.m
//  LegalObserver
//
//  Created by Roxanne Brittain on 11/5/11.
//  Copyright (c) 2011 Digifit. All rights reserved.
//

#import "TextViewController.h"

@implementation TextViewController

- (id)initWithTextFileName:(NSString*)name
{
    self = [super initWithNibName:nil bundle:nil];
    if (self) {
        NSString *filePath = [[NSBundle mainBundle] pathForResource:name ofType:@"txt"];
        
        string = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UITextView *textView = [[UITextView alloc] initWithFrame:self.view.bounds];
    textView.font = [UIFont systemFontOfSize:14];
    textView.alwaysBounceVertical = YES;
    [textView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];
    [textView setDataDetectorTypes:UIDataDetectorTypeLink];
    textView.editable = NO;
    [self.view addSubview:textView];
    textView.text = string;
                                                                        
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
